#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;


// Definition for singly-linked list.
struct ListNode {
    int val;
    ListNode *next;
    ListNode(int x) : val(x), next(NULL) {}
};
 
class Solution {
public:
    vector<int> reversePrint(ListNode* head) {
        vector<int> result;
        if(head==NULL){
            return result;
        }
        func(head,result);
        return result;

    }
    void func(ListNode* head, vector<int>& result){
        if(head==NULL){
            return;
        }
        func(head->next,result);
        result.push_back(head->val);
        return;
    }
};